package Terminal.UI.Test;

import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

import TerminalProprietario.Controller.CGestireTimeRecordControl;

public class Client {
	
	private static JFrame frame = new JFrame();
	
    public static void
    main(final String[] args)
    {
            
    		EventQueue.invokeLater(new Runnable() {
    			public void run() {
    				try {
    					
    					final CGestireTimeRecordControl control = new CGestireTimeRecordControl();
    					
    					frame.pack();
    					frame.setVisible(true);   
    					
    					JPanel pannello = new JPanel();
    					JButton bottoneStart= new JButton();
    					JButton bottoneStop= new JButton();    					
    					
    					frame.setLayout(null);
    					frame.setBounds(0, 0, 300, 400);
    					
    					pannello.setLayout(null);
    					pannello.setBounds(1, 1, 300, 400);
    					
    					bottoneStart.setBounds(50, 100, 200, 50);
    					bottoneStop.setBounds(50, 200, 200, 50);    					
    					
    					bottoneStart.setText("Start Time Record");
    					bottoneStop.setText("Stop Time Record");    					
    					
    					bottoneStart.addActionListener(new ActionListener() 
    					{
							@Override
							public void actionPerformed(ActionEvent arg0) {
								
						        control.startTimeRecord();
								
							};
    					});
    					
       					bottoneStop.addActionListener(new ActionListener() 
    					{
							@Override
							public void actionPerformed(ActionEvent arg0) {
								
								control.stopTimeRecord("tentativo da UI terminal client");
								
							};
    					});   					
    						
    					pannello.add(bottoneStart);
    					pannello.add(bottoneStop);    					
    					frame.add(pannello);
    					
 					
    					
    				} catch (Exception e) {
    					e.printStackTrace();
    				}
    			}
    			}); 
            

}}
